package com.yequan.leetcode.recursion.factorial;

/**
 * 阶乘
 *
 * @author : Administrator
 * @date : 2020/3/29
 */
public class Factorial {


    public static void main(String[] args) {
        Factorial factorial = new Factorial();
        System.out.println(factorial.factorial(2));
        System.out.println(factorial.factorial(6));
    }

    public int factorial(int n) {

        if (n <= 1) {
            return 1;
        }

        return n * factorial(n - 1);

    }

}
